import numpy as np
import time
from functools import wraps

def fn_timer(function):
    @wraps(function)
    def function_timer(*args, **kwargs):
        t0 = time.time()
        result = function(*args, **kwargs)
        t1 = time.time()
        print("Total time running :" + str(t1 - t0)+"seconds" )
        return result
    return function_timer

@fn_timer
def insertion_sort(old):
    for i in range(1,len(old)):
        tem = old[i]
        for j in range(i,0,-1):
            if tem < old[j-1]:
                old[j] = old[j-1]
                old[j-1] = tem
    return old

if __name__ == '__main__':
    # ol = [1, 56, 84, 23, 1, 5, 78, 3, 9, 2]
    new = np.random.randint(0, 100, 1000)
    look = insertion_sort(new)